<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>GuessWordGame</title>
</head>

<body>
    <script>
        function getRandom(min, max) {
            return Math.floor(Math.random() * (max - min + 1)) + min;
        }
        let num = getRandom(1, 100);
        for (i = 1; i <= 5; i++) {
            let input = prompt('请输入一个数，1~100之间');
            if (input > num) {
                alert('数字大了，请重新输入');
            } else if (input < num) {
                alert('数字小了，请重新输入');
            } else {
                alert('Bingo,你猜对了！');
                break;
            }
            while (i > 5) {
                window.alert('已猜五次，机会用完，结束。');
                break;
            }
        }
    </script>
</body>

</html>